package com.itheima.setlist;

import java.util.Comparator;
import java.util.TreeSet;

public class Demo {
    public static void main(String[] args) {
        TreeSet<String> t = new TreeSet<>((o1, o2) -> {
            int result = o1.length() - o2.length();
            result = result == 0 ? o1.compareTo(o2) : result;
            result = result == 0 ? 1 : result;
            return result;
        });
        t.add("c");
        t.add("ab");
        t.add("df");
        t.add("qwer");
        t.add("qwer");

        System.out.println(t);

    }
}
